package com.daona.job.flow.component;

import com.daona.job.flow.context.PdfContext;
import com.daona.job.service.PdfService;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import lombok.RequiredArgsConstructor;

import java.util.List;

@LiteflowComponent
@RequiredArgsConstructor
public class HtmlToPdf extends NodeComponent {

    private final PdfService pdfService;

    @Override
    public void process() throws Exception {

        PdfContext context = this.getRequestData();
        List<String> pdfs = pdfService.generateMultiplePdf(context.getPdfModel());
        context.setPdfs(pdfs);
    }
}
